<?php

function function_a()
{
    $name = 'li';
    $age = '18';
    $sex = '1';


    $params = new \liyuze\Parameters\Parameters([
        'name' => $name,
        'age' => $age,
        'sex' => $sex,
    ]);
    function_b($params);
}

function function_b(\liyuze\Parameters\Parameters $params)
{
    $params->setValidateConfig([
        'name' => 'required',
        'age' => ['required', 'number', 'max' => 120, 'min' => 18,],
        'sex' => ['required']
    ]);

    //进行验证
    if (!$params->validate()) {
        //获取错误
        $params->getErrors();
    }
}



